package org.ethan.lyl.util;


import org.springframework.lang.Nullable;

public class ResultDto {

    private boolean isSuccess;

    private String msg;

    private Object data;

    public ResultDto(){}

    public ResultDto(boolean isSuccess, String msg)
    {
        this.isSuccess = isSuccess;
        this.msg = msg;
    }

    public ResultDto(boolean isSuccess, String msg, Object data)
    {
        this.isSuccess = isSuccess;
        this.msg = msg;
        this.data = data;
    }

    public static ResultDto success(){
        return new ResultDto(true,null,null);
    }

    public static ResultDto success(@Nullable String msg, @Nullable Object o){
        return new ResultDto(true,msg,o);
    }

    public static ResultDto fail(@Nullable String msg){
        return new ResultDto(false,msg);
    }
    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public void setSuccessMsg(String  msg){
        this.isSuccess=true;
        this.msg=msg;
    }
    public void setFailMsg(String  msg){
        this.isSuccess=false;
        this.msg=msg;
    }

}
